package com.pandi.springbootinfluxdb.v02;

import org.influxdb.dto.Point;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author pandi
 * @create 2021-04-20 11:31
 */
@RestController
public class PandiController {

//    @Autowired
    private InfluxMapper influxMapper;

    @GetMapping("queryAll")
    public List<Pandi> queryAll() {
        List<Pandi> query = influxMapper.query(Pandi.class);
        return query;
    }

    @PostMapping("save")
    public String save(@RequestBody Pandi pandi) {
        influxMapper.save(pandi);
        return "OK";
    }


}
